<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<script type="text/javascript">
	var sidebarMenu;
	var btnUrlClassList;
	var btnUrlItemList;
	var btnUrlClassTree;
	var btnUserList;
	var btnAdvertismentList;
	var btnSuggestionList;
	$(function() {
		// 侧边菜单栏
		sidebarMenu = $('#sidebarMenu').accordion({
			animate : false,
			fit : true
		});

		btnUrlClassList = $('#btnUrlClassList').linkbutton({
			plain : true
		});
		btnUrlItemList = $('#btnUrlItemList').linkbutton({
			plain : true
		});
		btnUrlClassTree = $('#btnUrlClassTree').linkbutton({
			plain : true
		});
		btnAdvertismentList = $('#btnAdvertismentList').linkbutton({
			plain : true
		});

		btnUrlClassList.bind("click", {
			title : "网址分类",
			url : '/com.sundaying.gooway/admin/urlclass_list.jsp'
		}, showTab);

		btnUrlItemList.bind("click", {
			title : "网址列表",
			url : '/com.sundaying.gooway/admin/urlitem_list.jsp'
		}, showTab);

		btnUrlClassTree.bind("click", {
			title : "网址分类树",
			url : '/com.sundaying.gooway/admin/urlclass_tree.jsp'
		}, showTab);

		btnUserList = $('#btnUserList').linkbutton({
			plain : true
		});

		btnUserList.bind("click", {
			title : "用户列表",
			url : '/com.sundaying.gooway/admin/user_list.jsp'
		}, showTab);

		btnAdvertismentList.bind("click", {
			title : "广告列表",
			url : '/com.sundaying.gooway/admin/advertisement_list.jsp'
		}, showTab);
		
		btnSuggestionList = $('#btnSuggestionList').linkbutton({
			plain : true
		});
		btnSuggestionList.bind("click", {
			title : "意见箱",
			url : '/com.sundaying.gooway/admin/suggestion_list.jsp'
		}, showTab);

		// 测试按钮
		$('#btnTest').bind("click", test);
	});

	// 打开或切换选项卡
	function showTab(event) {
		var title = event.data.title;
		var url = event.data.url;
		console.info(title);
		if (centerTabs.tabs('exists', title)) {
			centerTabs.tabs('select', title);
			console.info('已选择：' + title);
		} else {
			centerTabs
					.tabs(
							'add',
							{
								title : title,
								content : '<iframe style="width:100%;height:100%;" scrolling="auto" frameborder="0" src="'
										+ url + '"></iframe>',
								closable : true,
								tools : [{
									iconCls : 'icon-refresh',
									handler : function() {
									}
								}]
							});
			console.info('已打开：' + title);
		}
	};

	function test() {
		// 		alert("Screen resolution: " + screen.width + "*" + screen.height);
		alert("浏览器版本：" + navigator.appName + " | " + navigator.appCodeName
				+ "|" + navigator.appVersion + " | " + navigator.userAgent);

		var Sys = {};
		var ua = navigator.userAgent.toLowerCase();
		var s;
		(s = ua.match(/msie ([\d.]+)/)) ? Sys.ie = s[1] : (s = ua
				.match(/firefox\/([\d.]+)/)) ? Sys.firefox = s[1] : (s = ua
				.match(/chrome\/([\d.]+)/)) ? Sys.chrome = s[1] : (s = ua
				.match(/opera.([\d.]+)/)) ? Sys.opera = s[1] : (s = ua
				.match(/version\/([\d.]+).*safari/)) ? Sys.safari = s[1] : 0;
		if (Sys.ie) {
			if (Sys.ie != 7.0) {
				alert("您当前使用的是 IE" + Sys.ie + "浏览器!");
			}
		} else if (Sys.firefox) {
			alert("您当前使用的是 Firefox" + Sys.firefox + "浏览器!");
		} else if (Sys.chrome) {
			alert("您当前使用的是 Chrome" + Sys.chrome + "浏览器!");
		} else if (Sys.opera) {
			alert("您当前使用的是 Opera" + Sys.opera + "浏览器!");
		} else if (Sys.safari) {
			alert("您当前使用的是 Safari" + Sys.safari + "浏览器!");
		} else {
			alert("无法检测出您正在使用的浏览器版本!为了您使用的方便,我们建议您使用IE7.0版浏览器!");
			return false;
		}
	}
</script>
<div id="sidebarMenu" class="easyui-accordion">
	<div title="网址管理" style="overflow: auto; padding: 10px;"
		selected="true">
		<h3 style="color: #0099FF;">
			<a id="btnUrlClassList" href="#">网址分类</a>
		</h3>
		<h3 style="color: #0099FF;">
			<a id="btnUrlItemList" href="#">网址列表</a>
		</h3>
		<h3 style="color: #0099FF;">
			<a id="btnUrlClassTree" href="#">网址分类树</a>
		</h3>
	</div>
	<div title="广告管理" style="padding: 10px;">
		<h3 style="color: #0099FF;">
			<a id="btnAdvertismentList" href="#">广告列表</a>
		</h3>
	</div>
	<div title="反馈意见" style="padding: 10px;">
		<h3 style="color: #0099FF;">
			<a id="btnSuggestionList" href="#">意见箱</a>
		</h3>
	</div>
	<div title="用户管理" style="padding: 10px;">
		<h3 style="color: #0099FF;">
			<a id="btnUserList" href="#">用户列表</a>
		</h3>
	</div>
	<div title="测试栏" style="padding: 10px;">
		<h3 style="color: #0099FF;">
			<a id="btnTest" href="#">测试</a>
		</h3>
	</div>
</div>